<?php
/**
 * Created by JetBrains PhpStorm.
 * User:Mihail Markitan
 * Date: 10/30/11
 * Time: 9:47 PM
 */
?>


<div class="form">
    <?php
    $form = $this->beginWidget('CActiveForm', array(
        'id' => 'invoice-form',
        'enableAjaxValidation' => false,
            ));
    ?>


    <div class="row" style="height:80px">
        <table style=" width: 755px;">
            <tr>
                <td style=" width: 363px;">
                    <?php echo $form->labelEx($model, 'billloc', array('style' => 'width: 100px;')); ?>
                    <br clear="all"/>
                    <?php
                    $customer = Customers::model()->findByPk($model->custno);

                    $data = $model->getBillToList($location->custno);
                    echo $form->dropDownList($model, 'billloc', $data);
                    ?>

                    <?php echo $form->error($model, 'billloc'); ?> 
                    <br clear="all"/>
                    <span id='billadd1'></span><br/>
                    <span id='billadd2'></span><br/>
                    <span id='billcsz'></span><br/>
                </td>
                <td >

                    <label>Ship To</label>

                    <br clear="all"/>
                    <div class="model-data">
                        <?= $model->shipname ?>
                    </div>
                    <br clear="all"/>
                    <?= $model->shipaddress1 ?><br/>
                    <?= $model->shipaddress2 ?><br/>
                    <?= $model->shipCSZ ?><br/>
                </td>

            </tr>
        </table>

    </div>
    <br clear="both"/>  <br clear="both"/> <br clear="both"/>
    <div class="left-column">
        <div class="row short">
            <?php echo $form->labelEx($model, 'invoice'); ?>
            <?php echo $form->textField($model, 'invoice'); ?>
            <?php echo $form->error($model, 'invoice'); ?>


        </div>
        <div class="row short">
            <?php echo $form->labelEx($model, 'invoicedate'); ?>

            <?php
            $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                'model' => $model,
                'attribute' => 'invoicedate',
                'value' => $model->invoicedate,
                'options' => array('dateFormat' => 'yy-m-d'),
            ));
            ?>

            <?php echo $form->error($model, 'invoicedate'); ?>



        </div>
        <div class="row short">
            <?php echo $form->labelEx($model, 'department'); ?>
            <?php echo $form->dropDownList($model, 'department', $model->getDepartments()); ?>
            <?php echo $form->error($model, 'department'); ?>


        </div>
        <div class="row short">
            <?php echo $form->labelEx($model, 'taxcode'); ?>
            <?php echo $form->dropDownList($model, 'taxcode', $model->getTaxCodeList()); ?>
            <?php echo $form->error($model, 'taxcode'); ?>


        </div>
        <div class="row short">
            <?php echo $form->labelEx($model, 'jobnumber'); ?>
            <?php echo $form->dropDownList($model, 'jobnumber', Jobs::getList()); ?>
            <?php echo $form->error($model, 'jobnumber') ?>

        </div>
        <div class="row">
            <?php echo $form->labelEx($model,'ponumber');?>
            <?php echo $form->textField($model,'ponumber');?>
            <?php echo $form->error($model,'ponumber');?>

            <?php //echo CHtml::submitButton($model->isNewRecord ? 'Create Invoice' : 'Save', array('align' => 'left')); ?>

        </div>


    </div>
    <div class="right-column">
        <div class="row short">
            <?php echo $form->labelEx($model, 'agreementno'); ?>
            <?php echo $form->dropDownList($model, 'agreementno', array(1 => 'Test', 2 => 'Test2')); ?>
            <?php echo $form->error($model, 'agreementno'); ?>
        </div>
        <div class="row short">
            <?php echo $form->labelEx($model, 'pricecode'); ?>
            <?php echo $form->dropDownList($model, 'pricecode', array('A' => 'A', 'B' => 'B', 'C' => 'C')); ?>
            <?php echo $form->error($model, 'pricecode'); ?>
        </div>
        <div class="row short">
            <?php echo $form->labelEx($model, 'salesperson'); ?>
            <?php
            $data = Customers::model()->getSalePersonList();
            echo $form->dropDownList($model, 'salesperson', $data);
            ?>
            <?php echo $form->error($model, 'salesperson'); ?>
        </div>
        <div class="row short">
            <?php echo $form->labelEx($model, 'clerk'); ?>
            <div class="model-data">
                <?php echo $model->clerk;?>
            </div>
            
        </div>
        <div class="row short">
            <?php echo $form->labelEx($model, 'slterms'); ?>
            <?php echo $form->dropDownList($model, 'slterms', Customers::model()->getTermList()); ?>
            <?php echo $form->error($model, 'slterms'); ?>
        </div>
    </div>



    <br clear="both"/>
    <div id="customer-tab">


    </div>
    <div class="row">

    </div>

    <?php $this->endWidget(); ?>
</div>
<table>
    <tr>
        <td>Dispatch</td>
        <td><?=$model->dispatch?></td>
        <td></td>
        <td></td>
        <td>Balance</td>
        <td></td>
    </tr>
    <tr>
        <td>Regular Hours</td>
        <td><?=InvoiceEmp::model()->getTotalRegularHours($model->invoice)?></td>
        <td>Discount</td>
        <td></td>
        <td>Over 30</td>
        <td></td>              
    </tr>
    <tr>
        <td>Overtime</td>
        <td><?=InvoiceEmp::model()->getTotalRegularHours($model->invoice)?></td>
        <td></td>
        <td></td>
        <td>Over 60</td>
        <td></td>
    </tr>
    <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td>Over 90</td>
        <td></td>
    </tr>
</table>
